package com.javalab._3object_oriented._3abstract;

/**
 * 除法计算器
 */
public class DividCalculator extends AbstCaculator {
    @Override
    public Double calculate(Double a, Double b) throws Exception {
        // 校验
        validate(a, b);
        return a / b;
    }

    @Override
    public void validate(Double a, Double b) throws Exception {
        if (b == 0) {
            throw new Exception("不允许除零");
        }
    }
}
